# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gimp
pkgver=2.10.38
pkgrel=3
pkgdesc="GNU Image Manipulation Program"
url="https://www.gimp.org/"
# nobody is using this on s390x
arch="all !s390x"
license="GPL-3.0-or-later"
makedepends="
	babl-dev
	desktop-file-utils
	gegl-dev
	gexiv2-dev
	glib-networking
	gtk+2.0-dev
	intltool
	iso-codes-dev
	lcms2-dev
	libavif-dev
	libexif-dev
	libheif-dev
	libjpeg-turbo-dev
	libjxl-dev
	libmypaint-dev
	libpng-dev
	librsvg-dev
	libxcursor-dev
	libxmu-dev
	libxpm-dev
	mypaint-brushes
	poppler-data
	poppler-dev
	tiff-dev
	xz-dev
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
source="https://download.gimp.org/pub/gimp/v${pkgver%.*}/gimp-$pkgver.tar.bz2
	0001-plug-ins-Backport-of-fixes-for-gcc-14.patch"
options="!check"

# secfixes:
#   2.10.36-r0:
#     - CVE-2023-44441 ZDI-CAN-22093
#     - CVE-2023-44442 ZDI-CAN-22094
#     - CVE-2023-44443 ZDI-CAN-22096
#     - CVE-2023-44444 ZDI-CAN-22097
#   2.8.22-r2:
#     - CVE-2017-17784
#     - CVE-2017-17785
#     - CVE-2017-17786
#     - CVE-2017-17787
#     - CVE-2017-17788
#     - CVE-2017-17789

prepare() {
	default_prepare
	update_config_sub
}

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	CXXFLAGS="$CXXFLAGS -flto=auto" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-dependency-tracking \
		--sysconfdir=/etc \
		--enable-mp \
		--enable-gimp-console \
		--disable-python \
		--without-aa \
		--disable-check-update
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

dev() {
	default_dev
	amove usr/bin/gimptool*
}

sha512sums="
343bf1c3bd14bf8e7c7af79c05920faca213da68549127c1d8af53e2e872e55aeaf39a3cfcf578183a34fdc4f98e1c859be63956b0611067186eefd1fdee2aaa  gimp-2.10.38.tar.bz2
797a46106d83bf9ec07144417793d9b8ee8108cec8b1a8f866ab0a5262f6f19c5513d7fe3cc9532a0189e53e69a2707b412826353697696dc4d91b1517c679f7  0001-plug-ins-Backport-of-fixes-for-gcc-14.patch
"
